from django.db import models

# 基金信息
class WealthOffsitefund(models.Model):
    code = models.CharField( max_length=255, blank=True, null=False)
    name = models.CharField( max_length=255, blank=True, null=False)
    fund_type = models.CharField(max_length=100, blank=True, null=True)
    risk_level = models.CharField(max_length=100, blank=True, null=True)
    industry = models.CharField(max_length=100, blank=True, null=True)
    fund_manager = models.CharField(max_length=100, blank=True, null=True)
    established_date = models.DateField(blank=True, null=True)
    fund_company = models.CharField(max_length=100, blank=True, null=True)
    fund_scale = models.CharField(max_length=100, blank=True, null=True)
    buy_rule = models.CharField(max_length=100, blank=True,null=True)
    sell_rule = models.CharField(max_length=100, blank=True, null=True)

    create_time = models.DateTimeField(blank=True, null=True)
    update_time = models.DateTimeField(blank=True, null=True)

    class Meta:
        managed = True
        db_table = 'wealth_offsitefund'

# 基金净值
class WealthNetvalue(models.Model):
    code = models.CharField( max_length=255, blank=True, null=False)
    date = models.DateField(blank=True, null=True)
    netvalue = models.DecimalField(max_digits=10, decimal_places=5, blank=True, null=True)
    accnetvalue = models.DecimalField(max_digits=10, decimal_places=5, blank=True, null=True)
    day_increase = models.DecimalField(max_digits=10, decimal_places=5, blank=True, null=True)
    dividend = models.CharField( max_length=255, blank=True, null=False)

    create_time = models.DateTimeField(blank=True, null=True)
    update_time = models.DateTimeField(blank=True, null=True)

    class Meta:
        managed = True
        db_table = 'wealth_netvalue'

# 基金估值
class WealthImputedvalue(models.Model):
    code = models.CharField( max_length=255, blank=True, null=False)
    date = models.DateField(blank=True, null=True)
    netvalue = models.DecimalField(max_digits=10, decimal_places=5, blank=True, null=True)

    create_time = models.DateTimeField(blank=True, null=True)
    update_time = models.DateTimeField(blank=True, null=True)

    class Meta:
        managed = True
        db_table = 'wealth_imputedvalue'

# 持仓
class WealthHoldings(models.Model):
    code = models.CharField( max_length=255, blank=True, null=False)
    buy_platform = models.CharField( max_length=255, blank=True, null=False)
    share = models.DecimalField(max_digits=100, decimal_places=5, blank=True, null=True)

    create_time = models.DateTimeField(blank=True, null=True)
    update_time = models.DateTimeField(blank=True, null=True)

    class Meta:
        managed = True
        db_table = 'wealth_holdings'

# 交易记录
class WealthTraderecord(models.Model):
    code = models.CharField( max_length=255, blank=True, null=False)
    trade_date = models.DateField(blank=True, null=True)
    deal_status = models.CharField( max_length=255, blank=True, null=False)
    dela_price = models.DecimalField(max_digits=100, decimal_places=5, blank=True, null=True)
    share = models.DecimalField(max_digits=100, decimal_places=5, blank=True, null=True)

    create_time = models.DateTimeField(blank=True, null=True)
    update_time = models.DateTimeField(blank=True, null=True)

    class Meta:
        managed = True
        db_table = 'wealth_traderecord'

# 盈亏记录
class WealthBreakrecord(models.Model):
    code = models.CharField( max_length=255, blank=True, null=False)
    date = models.DateField(blank=True, null=True)
    amount = models.DecimalField(max_digits=100, decimal_places=5, blank=True, null=True)

    create_time = models.DateTimeField(blank=True, null=True)
    update_time = models.DateTimeField(blank=True, null=True)

    class Meta:
        managed = True
        db_table = 'wealth_breakrecord'